import os

# help(os)
# print(dir(os))

# # 获取操作系统名称 nt：windows  posix: linux
# print(os.name)
# # 获取系统环境变量信息
# print(os.environ)
# # 获取指定名称的环境变量信息
# print(os.getenv('PATH'))
# # 执行系统指令
# os.system('dir')

# 获取当前目录
# print(os.getcwd())
# 切换目录
# os.chdir('..')
# print(os.getcwd())
# 列出当前目录内容
# print(os.listdir())
# 创建空目录
# os.mkdir('new')
# 递归创建多级目录
# os.makedirs('a/b/c')
# 删除空目录
# os.rmdir('new')
# # 重命名目录
# os.rename('new','news')
# # 删除文件
# os.remove('word.txt')

# 返回绝对路径
# print(os.path.abspath('./os_demo.py'))
# 返回文件名
# print(os.path.basename("D:\python_study-auto\python_study\demo\os_demo.py"))
# 返回文件路径
# print(os.path.dirname("D:\python_study-auto\python_study\demo\os_demo.py"))
# 分割路径
# print(os.path.split("D:\python_study-auto\python_study\demo\os_demo.py"))
# 拼接路径
# print(os.path.join("D:\python_study-auto\python_study\demo", "os_demo.py"))
# 判断路径是否存在
# print(os.path.exists("D:\python_study-auto\python_study\demo\os_demo.py"))
# print(os.path.exists("./os_demo.py"))
# 判断是否是目录
# print(os.path.isdir("D:\python_study-auto\python_study\demo"))
# 判断是否是文件
# print(os.path.isfile("os_demo.py"))
# 获取文件大小
print(os.path.getsize("os_demo.py"))